﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Class="Indigo.Quibbler.Controls.SubCategoryControl"
    xmlns:local="clr-namespace:Indigo.Quibbler.Controls"
	x:Name="UserControl">
    <UserControl.Resources>
        <local:SectionTitleConverter x:Key="SectionTitleConverter"/>
        <ItemsPanelTemplate x:Key="listItemLayoutTemplate">
            <WrapPanel Orientation="Horizontal" IsItemsHost="True" MaxWidth="{Binding ElementName=listBox,Path=ActualWidth}"/>
            <!--<VirtualizingStackPanel IsItemsHost="True" Orientation="Horizontal"/>-->
        </ItemsPanelTemplate>
        <Style x:Key="listBoxStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Padding" Value="2,0,0,0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" Margin="5,5,5,5" RenderTransformOrigin="0.5,0.5">
                            <Border.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    <SkewTransform/>
                                    <RotateTransform/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </Border.RenderTransform>
                            <Grid>
                                <TextBlock x:Name="txt"  Foreground="White" Background="{x:Null}" Text="{Binding Converter={StaticResource SectionTitleConverter}}" FontSize="12" FontFamily="Georgia" FontWeight="Bold"/>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true" >
                                <Setter TargetName="txt" Property="Foreground" Value="#FF84B9D3"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter TargetName="txt" Property="Foreground" Value="Gray"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <SolidColorBrush x:Key="ListBorder" Color="#828790"/>

    </UserControl.Resources>
    <Border  Background="#FF699FBB" BorderThickness="1" CornerRadius="6" Margin="10,0,10,0">
        <ListBox x:Name="listBox" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="1" ItemsPanel="{DynamicResource listItemLayoutTemplate}" Margin="0" ItemContainerStyle="{DynamicResource listBoxStyle}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" FontFamily="Georgia">
        </ListBox>
    </Border>
</UserControl>